<?php
namespace app\index\Controller;
use think\Controller;
class Demo extends Base {
//    所有操作的前置操作
    protected $beforeActionList = array(
        'before1'=> '',
        'before2'=> array('except'=>array('demo1','demo3')),
        'before3'=> array('only'=>array('demo2')),
    );
    protected $program = '';

    protected function before1(){
//        $this ->program = $this ->request ->param('name');
        $this ->program = '我是before1';
    }
    protected function before2(){
        $this ->program = '我是before2';
    }
    protected function before3(){
        $this ->program = '我是before3';
    }
    public function demo1(){
        return $this ->program;
    }

    public function demo2(){
        return $this ->program;
    }

    public function demo3(){
        return $this ->program;
    }

    public function testAction(){
        $one = array('a'=>1,'b'=>2);
        $two = array('b'=>3,'d'=>4);
        $three = array(1, 2);
        $four = array(3, 4, 5);
        print_r($one + $two);
        print_r(array_merge($one, $two));
        print_r($three + $four);
        print_r(array_merge($three, $four));
        echo "<br>";
        echo (float)(0.58*100);

        $five = array(1,5,2,10,6);
        var_dump($five);
        $six = arsort($five);
        var_dump($five);
    }
}